/**
 *通过构造器求一个三维坐标的点到另外一个三维坐标的距离
 */
package package_demo;


public class Point_constructor {
    double x,y,z;
    //构造器(构造方法)
    public Point_constructor (int _x,int _y,int _z){
        //初始化对象的属性
        x = _x;
        y = _y;
        z = _z;
        System.out.println(z);
    }

    public double distance(Point_constructor p){
        return (x-p.x)*(x-p.x)+(y-p.y)*(y-p.y)+(z-p.z)*(z-p.z);
    }

    public static void main(String[] args){
        Point_constructor p = new Point_constructor(1,2,3);
        Point_constructor p2 = new Point_constructor(4,5,6);
        System.out.println(p.distance(p2));
    }
}
